define(["jquery", "easy-admin"], function ($, ea) {
    function getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == variable) {
                return decodeURI(pair[1]);  //处理中文显示异常
            }
        }
    }

    var init = {
        table_elem: '#rewardTable',
        table_render_id: 'rewardTable',
        export_url: 'mall.reward_user/export?id='+getQueryVariable('id'),
    };

    var Controller = {
        reward: function () {
            ea.table.render({
                url: 'reward',
                where: {id: getQueryVariable('id')},
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    // {type: 'checkbox'},
                    {field: 'mallOrder.order_no', title: '订单号', search: false},
                    {field: 'amount', title: '奖励金额', templet: ea.table.price, search: false},
                    {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
                ]],
            });
            ea.listen();
        },

    };
    return Controller;
})
;